package com.gugee.tiktok.data.common.msg;

import com.gugee.tiktok.common.model.dto.SlimAwemeCommentDto;
import com.gugee.tiktok.data.common.util.ProtostuffUtil;
import lombok.Data;
import lombok.ToString;
import org.apache.kafka.common.serialization.Deserializer;
import org.apache.kafka.common.serialization.Serializer;

import java.util.List;
import java.util.Map;

/**
 * Description:处理粉丝画像消息
 * User: Huang xin
 * Date: 2020-11-12 18:06
 */
@ToString(callSuper = true)
@Data
public class FansPortraitMessage extends TiktokMessage {

    /**
     * 博主id
     */
    private long uid;

    /**
     * 视频id
     */
    private long awemeId;

    /**
     * 评论
     */
    private List<SlimAwemeCommentDto> comments;

    /**
     * 任务消息的反序列号
     *
     * @author luolifeng
     * @version 1.0.0
     * Date 2020/10/04
     * Time 15:03
     */
    public static class MsgDeserializer implements Deserializer<FansPortraitMessage> {
        @Override
        public void configure(Map map, boolean b) {

        }

        @Override
        public FansPortraitMessage deserialize(String topic, byte[] bytes) {
            return ProtostuffUtil.deserializer(bytes, FansPortraitMessage.class);
        }

        @Override
        public void close() {

        }
    }

    /**
     * Description 类描述
     *
     * @author luolifeng
     * @version 1.0.0
     * Date 2020/10/04
     * Time 15:12
     */
    public static class MsgSerializer implements Serializer<FansPortraitMessage> {
        @Override
        public void configure(Map map, boolean b) {

        }

        @Override
        public byte[] serialize(String topic, FansPortraitMessage keywordMessage) {
            return ProtostuffUtil.serializer(keywordMessage, FansPortraitMessage.class);
        }

        @Override
        public void close() {

        }
    }

}

